import * as mongoose from 'mongoose';
import db from '../lib/db/mongodb';

//门店拜访记录
let storeRecoderSchema: mongoose.Schema = new mongoose.Schema({
    sourceId: String,
    planId: String,
    timestamp: String,//时间戳
    userid: String,//员工的userid
    month: String,//写拜访记录的月份
    date: String,//写拜访记录的日期
    planDate: String, //拜访日期
    year:String,//年份 <========2019-01-21 增加此字段


    planType: String, //拜访类型 门店
    storeName: String,//门店名称
    storeCode: String,//门店编码
    //==========新增==============
    consumerAddress:String,//客户地址
    //==========新增===============
    storeType: String,//门店类型 示范网吧  SHOPPING  MALL潮品店  智能馆   
    //          LFR 其他 模范店 Gaming店 A/B店 音乐店
    position: String,//定位签到

    isChuchai: Boolean,//是否是出差

    isListSample: Boolean,//是否有样机出样
    sampleList: [{//样机列表
        sampleType: String,//样机型号
        Picturesample: []  //样机图片
    }],
    isListStandard: Boolean,//门店陈列是否达标
    competitor: String,//竞品单品
    storeActivity: String,//店内活动
    pictureStoreActivity: [],//店内活动照片
    picture: String,//门头照片   签到时的图片   拍摄门头照片(必须包含客户公司名称)
    isListLetter: Boolean,//是否有陈列函
    listLetter: String,//陈列函
    information: [{
        //(1)示范网吧
        mouseList: [{
            mousetype: String,
            mouseCount: String,
            mousePicture: []
        }],//鼠标
        keyBoardTtype: String,//键盘型号
        pictureBrand: [],//品牌专区照片
        brand: String,//品牌专区 可多选 LOGO灯箱|大幅画面- 灯箱/画面/玻璃贴|易拉宝|Shopping Mal|台卡
        //(2)模范店,Gomind店,---Shopping Mall 潮品店/智能馆/音乐店--,A/B店 LFR其他
        isListPart: Boolean,//是否陈列7节以上整柜---模范店
        //是否陈列3节以上整柜---Gamind店  
        //是否陈列2节以上整柜--Shopping Mall 潮品店/智能馆/音乐店 
        pictureFullContainer: [],//整柜照片
        isListNewProduct: Boolean,//是否有新品上架
        newProductList: [{
            newProductType: String,//新品型号
            pictureNewProduct:[] //新品照片
        }],

        pictureStoreFigure: [],//店招形象照片
        brandPicture: [],//品牌专区形象照片2
        picturePosm: [],//POSM形象照片
        pictureFrame: [],//画面形象照片


        storeTypes: String,//门店类型---Shopping Mall 潮品店/智能馆/音乐店
        //门店类型:APR,IT Mall,Music,Shopping Mall,书店,机场店,火车站店
        quarterNecessarySUK: Boolean,//季度必备SUK上架
        pictureSUK: [],//SUK照片
        pictureListFocus: [],//集中陈列的照片
        isListFocus: Boolean//是否集中陈列----A/B店 LFR其他
    }]
}, { collection: 'storeRecoder' });
export interface StoreRecoder extends mongoose.Document {
    sourceId: string;
    planId: string;
    timestamp: string;//时间戳
    userid: string;
    month: string;
    date: string;
    planDate: string;
    year:string;


    planType: string;
    storeName: string;
    storeCode: string;
    //==========新增==============
    consumerAddress:string;//客户地址
    //==========新增===============
    storeType: string;
    position: string;

    isChuchai: boolean;//是否是出差

    isListSample: boolean;
    sampleList: [{//样机列表
        sampleType: string,//样机型号
        Picturesample: any[]  //样机图片
    }],
    isListStandard: boolean;
    competitor: string;
    storeActivity: string;
    pictureStoreActivity: any[];
    picture: string;


    isListLetter: boolean;
    listLetter: string;

    information: [{
        mouseList: [{
            mousetype: string,
            mouseCount: string,
            mousePicture: any[]
        }],
        keyBoardTtype: string,
        pictureBrand: any[];//品牌专区照片
        brand: string,//品牌专区

        isListPart: boolean,
        pictureFullContainer:  any[],
        isListNewProduct: boolean,
        newProductList: [{//新品上架
            type: string,
            pictureNewProduct: any[]
        }],

        pictureStoreFigure:  any[];//店招形象照片
        brandPicture:  any[];//品牌专区形象照片2
        picturePosm:  any[];//POSM形象照片
        pictureFrame:  any[];//画面形象照片


        storeTypes: string;
        quarterNecessarySUK: boolean;
        pictureSUK:  any[];
        pictureListFocus:  any[];//集中陈列图片
        isListFocus: boolean
    }]
}
let storeRecoderModel = db.model<StoreRecoder>('storeRecoder', storeRecoderSchema);
export default storeRecoderModel;